package com.huage.courseplatform.satoken.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huage.courseplatform.framework.config.MybatisRedisCache;
import com.huage.courseplatform.satoken.model.entity.User;
import com.huage.courseplatform.satoken.model.vo.UserVO;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
//@CacheNamespace(implementation= MybatisRedisCache.class,eviction= MybatisRedisCache.class)
public interface UserMapper extends BaseMapper<User> {
    Page<UserVO> getUserAndRolesPage(Page<User> page, @Param(Constants.WRAPPER) Wrapper<UserVO> wrapper);

    /*
        中间表
     */

    int delUserRoleByUserId(String userId);

    int addUserAndRole(@Param("userId") String userId,@Param("roleId") String roleId);

}
